<template>
  <SModal
      v-model:show="modalShow"
      :title="modalTitle" @positive-click="onSubmit"
  >
    <SForm
        ref="formRef"
        :model="formValue"
    >
      <n-gi :span="12">
        <SFormInput name="name" label="歌名" required v-model:value="formValue.name" @load-rules="loadRules"/>
      </n-gi>
      <n-gi :span="12">
        <SFormUploadImg name="picFileId"
                        label="歌单封面"

                        :data="{folderName:'songListPic'}"
                        v-model:value="formValue.picFileId"
                        @load-rules="loadRules"/>
      </n-gi>
    </SForm>
  </SModal>
</template>
<script setup>
import SFormInput from "@/components/public/extForm/SFormInput.vue";
import SForm from "@/components/public/extForm/SForm.vue";
import SModal from "@/components/public/SModal/SModal.vue";
import useSModal from "@/components/public/SModal/useSModal";
import {getSongListById, updateSongList} from "@/api/music/songListApi";
import SFormUploadImg from "@/components/public/extForm/SFormUploadImg.vue";

const api = {
  editApi:updateSongList,
  getInfoById:getSongListById
}
const formDefValue = {

}
const {
  onEdit,
  loadRules,
  modalShow,
  modalLoading,
  modalTitle,onSubmit,
  formValue,
  formRef,
} = useSModal("歌单",formDefValue,api);

defineExpose({
  onEdit,
  modalLoading
})

</script>